//
//  voiceViewController.m
//  AIM
//
//  Created by user10 on 2017/7/5.
//  Copyright © 2017年 user10. All rights reserved.
//

#import "voiceViewController.h"
#import "LVRecordView.h"

@interface voiceViewController ()<LVRecordToolDelegate,LVRecordViewDelegate>

@property (nonatomic, strong) LVRecordView *recordView;

@property(nonatomic ,strong)NSURL *voiceUrl;

@end

@implementation voiceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.recordView = [LVRecordView recordView];
    self.recordView.recordTool.delegate = self;
    
    self.recordView.delegate = self;
    self.recordView.backgroundColor = [UIColor clearColor];
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    self.recordView.frame = CGRectMake(50, 100, width - 2 * 50, 200);
    [self.view addSubview:self.recordView];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - lVtool delegate
- (void)url:(NSURL *)url
{
    _voiceUrl = url;
}

- (void)send
{
    if ([self.delegate respondsToSelector:@selector(send:)]) {
        [self.delegate send:_voiceUrl];
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
